12
https://raw.githubusercontent.com/Pingvin235/bgerp/master/src/ru/bgcrm/plugin/bgbilling/proto/dao/PluginDAO.java
package ru.bgcrm.plugin.bgbilling.proto.dao;

import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import ru.bgcrm.model.BGException;
import ru.bgcrm.model.user.User;
import ru.bgcrm.plugin.bgbilling.DBInfo;
import ru.bgcrm.plugin.bgbilling.Request;
import ru.bgcrm.plugin.bgbilling.dao.BillingDAO;
import ru.bgcrm.util.XMLUtils;

public class PluginDAO
	extends BillingDAO
{
	public PluginDAO( User user, DBInfo dbInfo )
		throws BGException
	{
		super( user, dbInfo );
	}

	public PluginDAO( User user, String billingId )
		throws BGException
	{
		super( user, billingId );
	}

	public List<String> getInstalledPlugins()
		throws BGException
	{
		List<String> result = new ArrayList<String>();
		
		Request req = new Request();
		req.setModule( "installer" );
		req.setAction( "GetInstalledPlugins" );
		
		Document doc = transferData.postData( req, user );
		for( Element el : XMLUtils.selectElements( doc, "/data/plugin_list/plugin" ) )
		{
			result.add( el.getAttribute( "id" ) );
		}
		
		return result;			
	}
}
